package com.hospital.ssm.controller;

import com.hospital.ssm.model.Doctor;
import com.hospital.ssm.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DoctorController {

    @Autowired
    private DoctorService doctorService;

    @RequestMapping("/DoctorUi")
    public String getAll(Integer id,Model model){

        try {
            List<Doctor> doctors = doctorService.getAll(id);
            model.addAttribute("doctor",doctors);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "/Doctor";
    }



}
